package com.wuzhun.wxmp.service;

import com.wuzhun.wxmp.model.dto.TokenDTO;
import com.wuzhun.wxmp.model.entity.Token;
import com.baomidou.mybatisplus.extension.service.IService;

/**
 * <p>
 * 用户登录Token表 服务类
 * </p>
 *
 * @author renbaolin
 * @since 2022-12-05
 */
public interface ITokenService extends IService<Token> {
    /**
     * 根据uid查询用户token
     *
     * @param uid
     * @return
     */
    TokenDTO queryTokenByUid(Integer uid);

    /**
     * 生成token并保存
     * 
     * @param uid
     * @param ip
     * @return
     */
    TokenDTO generateAndInsert(Integer uid, String ip);

    /**
     * 校验Token
     * @param token
     * @return
     */
    boolean verifyToken(String token);

    /**
     * 根据token查询用户uid
     *
     * @param token
     * @return
     */
    Integer queryUidByToken(String token);
}
